<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>会员卡信息</title>
		<link rel="stylesheet" href="../static/cssdemo1/commons.css" />
		<link rel="stylesheet" href="../static/cssdemo1/date.css"/>
		<link rel="stylesheet" href="../static/cssdemo1/lxfs.css" />
		<link rel="stylesheet" href="../static/cssdemo1/xbtc.css" />
		<script type="text/javascript" src="../static/js/jquery.js" ></script>
		<script type="text/javascript" src="../static/js/date.js" ></script>
		<script type="text/javascript" src="../static/js/iscroll.js" ></script>
		<script src="../static/js/layer.js"></script>
		<script type="text/javascript">
		 $(function(){
		 	$("#tanchu2").click(function(){
  					 $(".page").show();
  					  $("#dateshadow").show();
			});
			$(".tanchu").date();
			$("#datePlugin").click(function(){
  					 $("#datePlugin #dateshadow").hide();
  					 $("#datePlugin #datePage").hide();
			});
			
		 });
		 
		 $(function(){
		 	$(".xb-clik").click(function(){
  					 $(".zzc").show();
  					  $(".xb-tc").show();
			});
			
			$(".zzc").click(function(){
  					 $(".zzc").hide();
  					 $(".xb-tc").hide();
			});
		 });
		 
		  $(function(){
		 	$(".hyzk-clik").click(function(){
  					 $(".zzc").show();
  					  $(".hyzk-tc").show();
			});
			
			$(".zzc").click(function(){
  					 $(".zzc").hide();
  					 $(".hyzk-tc").hide();
			});
		 });
		  $(function(){
			 	$(".yysp-clik").click(function(){
	  					 $(".zzc").show();
	  					  $(".yysp-tc").show();
				});
				
				$(".zzc").click(function(){
	  					 $(".zzc").hide();
	  					 $(".yysp-tc").hide();
				});
			 });
		 
		 
		</script>
	</head>
	<body>
		
		<div class="zzc"></div><!--服务项目弹出 开始-->
		<div class="hyzk-tc">
			<ul>
			<li class="conter">选择性别</li>
			<li onclick="setSex('先生')">先生</li>
			<li onclick="setSex('女士')">女士</li>
			<li onclick="setSex('儿童')">儿童</li>
			</ul>
		</div><!--服务项目弹出 结束 -->
		<div class="zzc"></div><!--服务项目弹出 开始-->
		<div class="yysp-tc">
		</div><!--服务项目弹出 结束 -->
	    <div id="datePlugin"></div><!--时间弹出  -->
		<div class="zzc"></div><!--性别弹出 开始-->
		<div class="xb-tc">
			<ul>
				<li class="conter">选择性别</li>
				<li>男</li>
				<li>女</li>
			</ul>
		</div><!--性别弹出 结束 -->
	    <div id="datePlugin"></div><!--时间弹出  -->
		<div class="outdiv">
			<div class="head-top"> <!--表头开始  -->
				<span class="bt">会员卡信息</span>
			</div> <!--表头结束  -->
			<div class="body-conter" style="bottom:42px; overflow:auto;"><!--页面详情开始  -->
				<div class="fgx"></div>
				<div class="zw-div">
					<!-- <ul>
						<li class="lx-bt">
							<span>基本信息</span>
							<i>l 必填  l</i>
						</li>
					</ul> -->
					<ul class="jtnr">
						<li>
							<span class="lie">客户姓名</span>
							<input name="" type="text" id="custom_name" placeholder="请输入客户姓名"/>
						</li>
						<li class="hyzk-clik">
							<span class="lie">客户性别</span>
							<span class="dqs">
								请选择客户性别
								<img src="../static/imgdemo1/qianjin-ioc.png" />
							</span>
						</li>
						<li>
							<span class="lie">客户手机号</span>
							<input name="" type="number" id="custom_phone" placeholder="请输入客户手机号"/>
						</li>
					</ul>
				</div>
				<!--底部菜单结束                                                                                                      -->
			</div> <!--页面详情结束  -->	
		</div>
		<div class="dbxq"><!--底部开始  -->
				保存
	    </div><!--底部结束  -->
	    <script type="text/javascript">
		function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
	    }
		var url = location.href;
		var param = url.split("?")[1];
		
		var BLRY = decodeURI(param.split("&")[0].split("=")[1]);
		var SZMD = decodeURI(param.split("&")[1].split("=")[1]);
		console.log(BLRY+SZMD);
		
		var date = new Date();
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		var day = date.getDate();
		month = (month > 9) ? month : ("0" + month);
		day = (day < 10) ? ("0" + day) : day;
		var today = year + "-" + month + "-" + day;
		
		var sex ="";
		function setSex(s){
			sex = s;
			$(".hyzk-clik .dqs").html(s+'<img src="../static/imgdemo1/qianjin-ioc.png" />');
	    	$(".zzc").hide();
			$(".hyzk-tc").hide();
		}
		
		 function CloseWebPage() {

             if (navigator.userAgent.indexOf("MSIE") > 0) {

                 if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {

                     window.opener = null; window.close();

                 }

                 else {

                     window.open('', '_top'); window.top.close();

                 }

             }

             else if (navigator.userAgent.indexOf("Firefox") > 0) {

                 window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的
                 //window.history.go(-2);

             }
             else {

                 window.opener = null;

                 window.open('', '_self', '');

                 window.close();
             }
         }
	    
	    	$(".dbxq").click(function(){
	    		//CloseWebPage();
	    		//return;
	    		if($("#custom_name").val()==""){
	    			layer.open({
					    content: "请输入客户姓名"
					    ,skin: 'msg'
					    ,time: 2//2秒后自动关闭
				  	});
	    			return;
	    		}
	    		if(sex==""){
	    			layer.open({
					    content: "请选择客户性别"
					    ,skin: 'msg'
					    ,time: 2//2秒后自动关闭
				  	});
	    			return;
	    		}
	    		if($("#custom_phone").val()==""){
	    			layer.open({
					    content: "请输入客户手机号"
					    ,skin: 'msg'
					    ,time: 2//2秒后自动关闭
				  	});
	    			return;
	    		}
	    		$.ajax({
					type: "POST",
					url: "../CustomSave",								
					data: {
						HYXM:$("#custom_name").val(),
						HYXB:sex,
						LXDH:$("#custom_phone").val(),
						BLRQ:today,
						BLRY:BLRY,
						SZMD:SZMD
					},	
					dataType: "json",
					success: function (data) {
						if(data.status=="success"){
							alert("保存成功");
							location.reload();
						}else{
							layer.open({
							    content: data.msg
							    ,skin: 'msg'
							    ,time: 2//2秒后自动关闭
						  	});
						}
					},
					error: function (data) {
						layer.open({
						    content: '网络连接繁忙，请稍候再试'
						    ,skin: 'msg'
						    ,time: 2//2秒后自动关闭
					  	});
					}
				});
	    		
	    	});
	    </script>
	</body>
</html>
